package com.wad.manager.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wad.entity.product.ProductSpec;
import com.wad.manager.mapper.ProductSpecMapper;
import com.wad.manager.service.ProductSpecService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wad
 * @date 2023/12/08 16:39
 * @project e-commerce
 **/
@Service
public class ProductSpecServiceImpl implements ProductSpecService {

    @Resource
    private ProductSpecMapper productSpecMapper;


    @Override
    public PageInfo<ProductSpec> findByPage(Integer page, Integer limit) {

        PageHelper.startPage(page,limit);
        List<ProductSpec> productSpecList=productSpecMapper.findByPage();
        return new PageInfo<>(productSpecList);
    }


    @Override
    public void save(ProductSpec productSpec) {
        productSpecMapper.save(productSpec);
    }

    @Override
    public void update(ProductSpec productSpec) {
        productSpecMapper.update(productSpec);
    }

    @Override
    public void deleteById(Long id) {
        productSpecMapper.deleteById(id);
    }
}
